class Ball {
	constructor(props) {
		this.x = 0;
		this.y = 0;
		this.r = 25;
		this.vx = 0; // x轴速度
		this.vy = 0; // y轴速度
		this.scaleX = 1;
		this.scaleY = 1;
		this.fillStyle = 'rgba(65,168,99,1)';
		this.strokeStyle = 'rgba(0,0,0,0)';
		Object.assign(this,props)
		return this
	}
	render(ctx){
		var {x,y,r,fillStyle,strokeStyle,scaleX,scaleY} = this
		// 保存绘图环境
		ctx.save()
		// 将画布坐标移动到x，y
		ctx.translate(x,y)
		ctx.scale(scaleX,scaleY) 
		ctx.fillStyle = fillStyle;
		ctx.strokeStyle = strokeStyle;
		ctx.beginPath()
		ctx.arc(0,0,r,0,2*Math.PI,false)
		ctx.fill()
		ctx.stroke()
		// 恢复绘图环境
		ctx.restore()
		return this
	}
}